package com.sc.nft.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.ProductCdkRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sc.nft.entity.vo.CdkExchangeRecordVO;
import com.sc.nft.entity.vo.ProductCdkRecordVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * (sc_product_cdk_record)数据Mapper
 *
 * @author Sun
 * @since 2022-08-22 16:34:19
 * @description 由 Mybatisplus Code Generator 创建
*/
@Mapper
public interface ProductCdkRecordMapper extends BaseMapper<ProductCdkRecord> {

    Page<ProductCdkRecordVO> getUserExchangeListByPage(Page page,@Param("userId") Long userId);

    /**
     * 后台查询兑换记录
     * @param page
     * @param userTel
     * @param cdk
     * @return
     */
    Page<CdkExchangeRecordVO> adminCdkExchangeRecord(Page page,@Param("userTel") String userTel,@Param("cdk") String cdk,@Param("cdkActivityId")Long cdkActivityId);

    /**
     * 判断用户自定义兑换码使用了多少次
     * @param userId
     * @param activityId
     * @return
     */
    Integer getListByUserIdAndActivityId(@Param("userId") Long userId,@Param("activityId") Long activityId);
}
